package com.kakarote.crm9.erp.jxc.service;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.kakarote.crm9.erp.jxc.entity.GoodsSuppliers;
import com.kakarote.crm9.erp.jxc.entity.ProcurementOrderDetails;
import com.kakarote.crm9.utils.PageData;
import com.kakarote.crm9.utils.R;

import java.util.List;

/**
 * @author ：青苔 1046600124
 * @date ：Created in 2021-03-22 14:11
 * @description：
 * @modified By：`
 * @version: 1.0
 */
public class ProcurementOrderDetailsService {

    public List<Record> list(Integer id){
       return Db.find(Db.getSql("jxc.ProcurementOrderDetails.queryList"),id);
    }
    public Record getInfo(Integer id){

        return Db.findFirst(Db.getSql("jxc.ProcurementOrderDetails.queryId"),id);
    }
    public R remove(List<String> ids){
        ProcurementOrderDetails details = new ProcurementOrderDetails();
        int temp=0;
        for (String id : ids) {
            if(id!=null &&!id.equals("")){
                temp+= Db.delete(Db.getSql("jxc.ProcurementOrderDetails.deleteProcurementOrderDetailsById"),id);
            }
        }
        return temp > 0 ? R.ok() : R.error("删除失败");
    }
}
